import Amplify, {I18n} from '@aws-amplify/core';
import {Authenticator} from '@aws-amplify/ui-react';

import {BrowserRouter, Route, Switch, Redirect} from 'react-router-dom';
import '@aws-amplify/ui-react/styles.css';

import Devices from './views/Devices';
import DeviceDetails from './views/DeviceDetails';
import SimulationCreate from './views/SimulationCreate';
import DeviceModify from './views/DeviceModify';
import Header from './components/Shared/Header';
import PageNotFound from './views/PageNotFound';
import AWS from 'aws-sdk';

import awsExports from './aws-exports';

Amplify.configure(awsExports);

export default function App() {
  return (
    // <Authenticator>
    //   {({signOut, user}) => (
        <div>
          <Header/>
          <div style={{ padding: '20px' }}>
            <BrowserRouter>
              <Switch>
                <Route
                  exact
                  path="/"
                  render={() => {
                    return (
                      <Redirect to="/devices"></Redirect>
                    )
                  }}
                />
                {/*<Route exact path="/simulations" render={() => <Simulations region={config.region} title={I18n.get("simulations")} />} />*/}
                <Route exact path="/simulations/create" render={() => <SimulationCreate region={awsExports.aws_project_region} title={I18n.get("simulation.creation")} />} />
                {/*<Route exact path="/simulations/:simId" render={(props) => <SimulationDetails region={config.region} title={I18n.get("simulation.details")} />} />*/}
                <Route exact path="/devices"
                      render={() => <Devices region={awsExports.aws_project_region} title={I18n.get("devices")}/>}/>
                <Route exact path="/devices/:deviceId" render={(props) => <DeviceDetails {...props} region={awsExports.aws_project_region} title={I18n.get("device.type.creation")} />} />
                <Route exact path="/devices/modify/:deviceId" render={(props) => <DeviceModify {...props} region={awsExports.aws_project_region} title={I18n.get("device.modify.description")} />} />
                <Route render={() => <PageNotFound/>}/>
              </Switch>
            </BrowserRouter>
          </div>
        </div>
    //   )}
    // </Authenticator>
  );
}